feat(web): add dream output viewer#27
Merged
Merged
Conversation
Dreams are currently a black box — to benchmark Tier L models on dreamer
induction quality we need to see what each model produced. This adds a
workspace-scoped /dreams route that surfaces every dream run as a
group of conclusions split into explicit / deductive / inductive
columns, with click-to-expand premise trees.
What's here:
- `lib/dreams.ts`: pure helpers. `clusterConclusionsIntoDreams` groups a
raw conclusions list into per-pair bursts using a configurable time
window (default 60s). `expandPremiseTree` walks `reasoning_tree` first
and falls back to a flat `premises` ID list, with cycle detection and
a depth cap. Defines an `ExtendedConclusion` type that augments the
generated schema with `conclusion_type`, `premises`, and
`reasoning_tree` — Honcho's migration f1a2b3c4d5e6 added those
columns but `schema.d.ts` doesn't expose them yet, so the UI degrades
gracefully (unknown types fall into "explicit").
- `api/queries.ts`: new `useDreams` hook that paginates the conclusions
list endpoint up to a configurable cap (default 400) and hands the
raw list to the UI for clustering. New `dreams` query key.
- `components/dreams/`:
- `DreamList.tsx` — route entry. Shows recent dreams as rows with
timestamp, observer→observed pair, and per-type counts. Selecting
a row expands an inline detail panel above the list.
- `DreamDetail.tsx` — three-column view (explicit / deductive /
inductive). Each inductive conclusion has a "Show premises" button
that expands the reasoning chain.
- `PremiseTree.tsx` — recursive premise renderer with type badges,
cycle indicator, and graceful handling of premises that fall
outside the loaded page.
- Routing: `routes/workspaces_.$workspaceId_.dreams.tsx` registers the
page; routeTree.gen.ts regenerated.
- Sidebar: new "Dreams" entry between Conclusions and Webhooks
(MoonStar icon to distinguish from the dark-mode Moon).
- Breadcrumb: "dreams" added to SECTION_LABELS so the trail resolves.
Tests (vitest, 14 new):
- clustering: empty input; same-pair burst within window; gap exceeds
threshold → split; different pairs don't merge even with overlapping
timestamps; custom gap window; newest-first ordering; counts default
unknown types to explicit.
- premise tree: empty children for no premises; flat list → direct
children; multi-level reasoning_tree recursion; missing premise
flagged (not in loaded page); cycle detection halts recursion;
maxDepth cap; reasoning_tree preferred over flat premises.
Verified manually in the preview: route mounts, sidebar/breadcrumb
resolve, error path renders cleanly, typecheck + lint + dream tests
all clean. The unrelated `app.test.tsx` failure is pre-existing on
main.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- packages/web/e2e/dreams.spec.ts: 4 tests covering sidebar entry, heading/breadcrumb resolution, mocked-API clustering into rows with count chips, and the premise-tree expansion path. Uses a function matcher for context.route so the trailing ?page=&page_size= query string doesn't break a glob. - docs/screenshots/: dark + light mode list and expanded-detail PNGs captured at 2880x1800 (retina) via playwright against the dev server with a tiny mock Honcho. - DreamList.tsx: add a literal space to CountChip's label fragment so the rendered text reads "3 explicit" instead of "3explicit" (gap-1 styles the visual layout but doesn't add a text-node space). Better for screen readers, copy/paste, and assertion via toContainText. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Clusters a peer's conclusions into per-pair "dream" bursts and renders the reasoning behind each — split into explicit/deductive/inductive, with a recursive (cycle-safe, depth-capped) premise tree.
lib/dreams.ts— clustering + premise-tree walk (own augmented types; 14+ unit tests)components/dreams/— DreamList, DreamDetail, PremiseTree/workspaces/$workspaceId/dreamsroute + sidebar/breadcrumb wiringRuntime note
The reasoning detail reads
conclusion_type/reasoning_tree/premises, which Honcho only returns after migrationf1a2b3c4d5e6.lib/dreams.tscarries its own types (so this typechecks against the current generated schema) and falls back to flat premises when the server doesn't supply a tree.Credit
Cherry-picked from @BenSheridanEdwards's fork (
feat/dream-viewer), authorship preserved. Thanks Ben!Verification
make check— lint + typecheck + 25/25 unit tests pass locally (e2e not run locally).